﻿using System;
using UnityEngine;
/// <summary>
/// 日志管理器
/// </summary>
public static partial class ESF_P
{
    #region Log
    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Log)]
#endif
    public static void ESF_Log(object _message)
    {
        Debug.Log($"[{ESF_ConditionalMacro.Log}]{OnGetPrefix()}{_message}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Log)]
#endif
    public static void ESF_Log(object _message, Color _color)
    {
        Debug.Log($"{$"[{ESF_ConditionalMacro.Log}]".ESF_ApplyColor(_color)}{OnGetPrefix()}{_message.ESF_ApplyColor(_color)}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Log)]
#endif
    public static void ESF_LogFormat(string _format, params object[] _args)
    {
        Debug.LogFormat($"{$"[{ESF_ConditionalMacro.Log}]"}{OnGetPrefix()}{string.Format(_format,_args)}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Log)]
#endif
    public static void ESF_LogFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogFormat($"{$"[{ESF_ConditionalMacro.Log.ESF_ApplyColor(_color)}]"}{OnGetPrefix()}{string.Format(_format,_args).ESF_ApplyColor(_color)}");
    }
    #endregion

    #region Warning
    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Warning)]
#endif
    public static void ESF_Warning(object _message)
    {
        Debug.LogWarning($"{$"[{ESF_ConditionalMacro.Warning.ESF_ApplyColor(Color.yellow)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(Color.yellow)}");
    }

    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Warning)]
#endif
    public static void ESF_Warning(object _message, Color _color)
    {
        Debug.LogWarning($"{$"[{ESF_ConditionalMacro.Warning.ESF_ApplyColor(Color.yellow)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(_color)}");
    }

    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Warning)]
#endif
    public static void ESF_WarningFormat(string _format, params object[] _args)
    {
        Debug.LogWarningFormat($"{$"[{ESF_ConditionalMacro.Warning.ESF_ApplyColor(Color.yellow)}]"}{OnGetPrefix()}{string.Format(_format,_args).ESF_ApplyColor(Color.yellow)}");
    }
    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Warning)]
#endif
    public static void ESF_WarningFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogWarningFormat($"{$"[{ESF_ConditionalMacro.Warning.ESF_ApplyColor(_color)}]"}{OnGetPrefix()}{string.Format(_format, _args).ESF_ApplyColor(_color)}");
    }
    #endregion

    #region Error
    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_message">信息</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Error)]
//#endif
    public static void ESF_Error(object _message)
    {
        Debug.LogError($"{$"[{ESF_ConditionalMacro.Error.ESF_ApplyColor(Color.red)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(Color.red)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Error)]
//#endif
    public static void ESF_Error(object _message, Color _color)
    {
        Debug.LogError($"{$"[{ESF_ConditionalMacro.Error.ESF_ApplyColor(Color.red)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(_color)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Error)]
//#endif
    public static void ESF_ErrorFormat(string _format, params object[] _args)
    {
        Debug.LogErrorFormat($"{$"[{ESF_ConditionalMacro.Error.ESF_ApplyColor(Color.red)}]"}{OnGetPrefix()}{string.Format(_format, _args).ESF_ApplyColor(Color.red)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Error)]
//#endif
    public static void ESF_ErrorFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogErrorFormat($"{$"[{ESF_ConditionalMacro.Error.ESF_ApplyColor(Color.red)}]"}{OnGetPrefix()}{string.Format(_format, _args).ESF_ApplyColor(_color)}");
    }
    #endregion

    #region Exception
    /// <summary>
    /// LogException
    /// </summary>
    /// <param name="_exception">Exception</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Exception)]
#endif
    public static void ESF_Exception(Exception _exception)
    {
        Debug.LogException(_exception);
    }
    #endregion

    #region Assertion
    /// <summary>
    /// LogAssertion
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Assertion)]
#endif
    public static void ESF_Assertion(object _message)
    {
        Debug.LogAssertion($"{$"[{ESF_ConditionalMacro.Assertion.ESF_ApplyColor(Color.magenta)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(Color.magenta).ESF_ApplyItalic()}");
    }

    /// <summary>
    /// LogAssertion
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Assertion)]
#endif
    public static void ESF_Assertion(object _message, Color _color)
    {
        Debug.LogAssertion($"{$"[{ESF_ConditionalMacro.Assertion.ESF_ApplyColor(Color.magenta)}]"}{OnGetPrefix()}{_message.ESF_ApplyColor(_color).ESF_ApplyColor(Color.magenta).ESF_ApplyItalic()}");
    }

    /// <summary>
    /// LogAssertionFormat
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Assertion)]
#endif
    public static void ESF_AssertionFormat(string _format, params object[] _args)
    {
        Debug.LogAssertionFormat($"{$"[{ESF_ConditionalMacro.Assertion.ESF_ApplyColor(Color.magenta)}]"}{OnGetPrefix()}{string.Format(_format, _args).ESF_ApplyColor(Color.magenta).ESF_ApplyItalic()}");
    }

    /// <summary>
    /// LogAssertionFormat
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(ESF_ConditionalMacro.Assertion)]
#endif
    public static void ESF_AssertionFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogAssertionFormat($"{$"[{ESF_ConditionalMacro.Assertion.ESF_ApplyColor(Color.magenta)}]"}{OnGetPrefix()}{string.Format(_format, _args).ESF_ApplyColor(_color).ESF_ApplyItalic()}");
    }
    #endregion
}